package com.nbgroup.controller;

import com.nbgroup.pojo.common.PageResult;
import com.nbgroup.pojo.common.Result;
import com.nbgroup.pojo.dto.PageDTO;
import com.nbgroup.pojo.dto.PageRoleDTO;
import com.nbgroup.pojo.vo.NoticeVo;
import com.nbgroup.service.NoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通知相关接口
 */
@RestController
@Slf4j
public class NoticeController {
    @Autowired
    private NoticeService noticeService;


    /**
     * 未读分页查询
     * @param dto
     * @return
     */
    @GetMapping("/system/notice/pagelist/0")
    public PageResult notice0(PageDTO dto){
        return noticeService.notice0(dto);
    }

    /**
     * 已读分页查询
     * @param dto
     * @return
     */
    @GetMapping("/system/notice/pagelist/1")
    public PageResult notice1(PageDTO dto){
        return noticeService.notice1(dto);
    }

    @PutMapping("/system/notice/{id}")
    public Result getInfo(@PathVariable Integer id) {
        NoticeVo vo = noticeService.getInfo(id);
        return Result.success(vo);
    }

}
